package me.android.library.starters.http;

import me.android.library.common.service.AbstractService;
import me.android.library.common.service.CrashLogService;
import me.android.library.utils.android.AppUtil;
import mylab.base.foundation.lang.Callback;

/**
 * Created by sylar on 16/8/17.
 */
public abstract class AbstractReportLogService extends AbstractService {

    public final static String LOG_TYPE_CRASH = "crash";
    protected CrashLogService.OnCrashedListener crashedListener = log -> {

        if (!AppUtil.isDebug()) {
            reportLog(LOG_TYPE_CRASH, log, null);
        }
    };

    public abstract void reportLog(String logType, String logContent, Callback<?> callback);

    @Override
    public void init() {
        super.init();
        CrashLogService.getInstance().setOnCrashedListener(crashedListener);
    }

}
